package com.yescall.mole;

import aurelienribon.tweenengine.TweenManager;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.OnActionCompleted;
import com.badlogic.gdx.scenes.scene2d.actions.MoveBy;
import com.badlogic.gdx.scenes.scene2d.actions.MoveTo;
import com.badlogic.gdx.scenes.scene2d.actions.Sequence;
import com.badlogic.gdx.scenes.scene2d.ui.Image;

public class Mole extends Image {
	private TweenManager tweenManager = new TweenManager();
	
	TextureRegion moleRegion;
	//MoveTo createAction;
	Sequence action;
	public boolean isAnimate = false;
	
	Mole(TextureRegion moleRegion){
		super(moleRegion);
		this.moleRegion = moleRegion;
		//Gdx.app.log( "mole",Integer.toString(this.moleRegion.hashCode()));
		
		//this.createAction = new MoveTo();
		//this.action(createAction);
		
		//action = Sequence.$(MoveBy.$(0, 100, 0.5f));
		//this.action(action);
	}
	
	public static Mole create(TextureRegion region){
		// TODO Auto-generated method stub
		return new Mole(new TextureRegion(region));
	}

	@Override
    public void act(float delta){
        super.act(delta);
        //showMole(delta);
    }
	
	public void showMole(float delta){
		//Gdx.app.log( "mole", Float.toString(delta));
		//this.originX = this.x;
		//this.originY = this.y;
		isAnimate = true;
		/*this.y = this.y - 100;
		action = Sequence.$(MoveTo.$(this.x, this.y+100, 1f));
		action.setCompletionListener(new OnActionCompleted(){
			@Override
			public void completed(Action action) {
				// TODO Auto-generated method stub
				//isAnimate = false;
			}
		});
		this.action(action);*/
		moleRegion.scroll(1f, delta-1);
		this.setRegion(moleRegion);
	}
}
